home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 8 / 008.d81 / dos #19 < prev    next >
Text File  |  2022-08-26  |  2KB  |  100 lines

  1.      DOS and DON'Ts -- Part 19
  2.  
  3.          by Joel Ellis Rea
  4.  
  5.  
  6.  
  7.    The format of an OPEN statement for
  8.  
  9. APPEND is:
  10.  
  11.  
  12.    OPEN <filenum>, <unitnum>, <chan-
  13.    nelnum>, '<filename>,[<type>]
  14.    ,A[PPEND]'
  15.  
  16.  
  17.    Some examples:
  18.  
  19.  
  20.    OPEN 8, 8, 8, "DATAFILE,A"
  21.  
  22.    OPEN F%, U%, C%, F$ + ",S,A"
  23.  
  24.    OPEN 1, 8, 2, "1:MACHLANG,P,A"
  25.  
  26.  
  27.  
  28.  
  29.    The first example OPENs the file
  30.  
  31. DATAFILE as file #8 via channel #8 of
  32.  
  33. drive unit #8.  The file type is not
  34.  
  35. checked, and the OPEN succeeds if the
  36.  
  37. file exists and is of type SEQ, PRG
  38.  
  39. or USR (REL and DEL don't work with
  40.  
  41. ,A[PPEND], of course).  If the OPEN
  42.  
  43. succeeds, all further PRINT#8 state-
  44.  
  45. ments will write their data starting
  46.  
  47. at the END of DATAFILE.
  48.  
  49.  
  50.    The second example OPENs a file
  51.  
  52. whose name is in the string variable
  53.  
  54. F$, giving it the file reference num-
  55.  
  56. ber specified in the integer variable
  57.  
  58. F%, via the channel in C% on the unit
  59.  
  60. in U%.  Since the file type was speci-
  61.  
  62. fied, the OPEN fails if the file is
  63.  
  64. not found, or if it is found but is
  65.  
  66. not of type SEQ.
  67.  
  68.  
  69.    The third example OPENs file 'MACH-
  70.  
  71. LANG', which must exist on drive 1 (of
  72.  
  73. a two-unit drive such as a CBM 4040 or
  74.  
  75. an MSD SD-2) as a PRG file.  This
  76.  
  77. might be used to add bytes to binary
  78.  
  79. data such as a translation table.
  80.  
  81.  
  82.    It is important to note that the ,A
  83.  
  84. mode REQUIRES that the file ALREADY
  85.  
  86. EXISTS on the disk.  So before you can
  87.  
  88. use the ,A mode on a new file, you
  89.  
  90. must first create the file with the
  91.  
  92. OPEN statement with a ,W parameter,
  93.  
  94. followed by at least one PRINT# state-
  95.  
  96. ment, followed by a CLOSE statement.
  97.  
  98.  
  99. ----------- End of Article -----------
  100.